package ysm.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ysm.entity.Codetable;
import ysm.entity.Codetabledetail;
import ysm.mapper.CodetableMapper;
import ysm.mapper.CodetabledetailMapper;

@Service
public class CodetableService {

	@Autowired
	private CodetabledetailMapper codetabledetailMapper;
	
	@Autowired
	private CodetableMapper codetableMapper;
	
	public List loadCodetalbeByName(String name) {
		Codetable codetable = codetableMapper.selectByname(name);
		return codetabledetailMapper.selectByPrimaryKey2(codetable.getId());
	}
	
	
	public List loadAll() {
		return codetableMapper.loadAll();
	}
	
	public void insertCodetableDetail(Codetabledetail record) {
		codetabledetailMapper.insert(record);
	}
	
	public void deleteByPrimaryKey(Integer id) {
		codetabledetailMapper.deleteByPrimaryKey(id);
	}
}
